package ink.lovejinhu.leetcode;

/**
 * @Author: jin
 * @Date: 2021/8/25 11:05
 * @Version: V1.0
 * @Slogan: Great people are not born great, but show their greatness in the process of growing up
 **/
public class Solution_0836 {
    /**
     * 矩阵重叠
     * int[] rec1={x1,y1,x2,y2}
     * <p>
     * <p>
     * <p>
     * x
     *
     * @param rec1
     * @param rec2
     * @return
     */
    public boolean isRectangleOverlap(int[] rec1, int[] rec2) {
        int x1 = rec1[0];
        int x2 = rec1[2];

        int y1 = rec1[1];
        int y2 = rec1[3];

        /**
         * x1,y2    x2 y2
         *
         * x1,y1    x2,y1
         */

        if (rec2[2] <= x1 || rec2[0] >= x2 || rec2[1] >= y2 || rec2[3] <= y1) {
            return false;
        }

        return true;
    }

}
